<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:include page="directive.jsp" />
<c:if test="${!empty param.from}">
    <c:set var="from" value="${param.from}" scope="session" />
</c:if>
<c:choose>
<%-- if not logged in --%>
<c:when test="${empty user.username}">

    <%-- if postback --%>
    <c:if test="${!empty param.username && !empty param.password}">
        <jsp:setProperty name="user" property="username" value="${param.username}"/>
        <jsp:setProperty name="user" property="password" value="${param.password}"/>
        <c:choose>
            <c:when test="${user.loginSuccessfully == true}">
                <jsp:setProperty name="cart" property="customerGroupID" value="${user.customer.customerGroupID.customerGroupID}"/>
                <c:if test="${!empty from}">
                    <jsp:forward page="${from}"/>
                </c:if>
                <jsp:forward page="index.jsp"/>
            </c:when>
            <c:otherwise>
                <c:set var="isLoginFailed" value="${true}"/>
            </c:otherwise>
        </c:choose>
    </c:if>

    
<jsp:include page="header.jsp" />  
    <div id="inner_wrap">
	<div id="inner_hold">
	<div id="inner">
	<div class="center_hold">
        <div class="big_padding">
		<div class="big_blue">
			<table width="100%" cellspacing="0" cellpadding="0">
				<tr>
					<td valign="top">
						<div class="listing_star">
							<h1 class="blue_sep_bot">Create an AAL account</h1>
							<div id="d_reg1" class="memty">
								<ul>
									<li>* Be the first to know about our <strong>exclusive</strong> promotions</li>
									<li>* Check out <strong>faster</strong> with your address book</li>
									<li>* Save items to your wish list and share with others</li>
									<li>* Get involved with the <strong>community</strong></li>
								</ul>
								<br />

								<p style="padding-bottom: 5px; font-weight: bold">New comers? Want to <em>join us</em>?</p>
								<ul>
									<li>* Welcome in! <strong><a href="register.jsp">Click here</a></strong> to register an AAL account and start shopping!</li>
								</ul>

							</div>
						</div>
					</td>
					<td width="130">&nbsp;</td>
					<td width="230" valign="top">
						<div id="loginbox">
							<h3>Members Login</h3>
                            <c:if test="${isLoginFailed == true}">
                            <p style="color: red">Wrong username and/or password!</p>
                            </c:if>
							<form action="login.jsp" method="post">
								<div><label for="username">Username</label></div>
								<p><input type="text" name="username" maxlength="255" class="sinput" style="width: 180px" /></p>

								<div><label for="password">Password</label></div>
								<p style="margin-bottom: 15px"><input type="password" name="password" maxlength="32" class="sinput" style="width: 180px" /></p>

								<div>
									<input type="submit" class="but_login" value="Login to AAL" />
								</div>
							</form>

							<div class="blue_sep"><a href="reset-password.jsp" rel="nofollow" class="blue">Forgot Your <strong>Password</strong>?</a></div>
						</div>
					</td>
				</tr>
			</table>
		</div>
	</div>
	</div>
	</div>
	</div>
	</div>

    <jsp:include page="footer.jsp" />
</c:when>
<c:otherwise>
    <jsp:forward page="index.jsp" />
</c:otherwise>
</c:choose>